home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / YICN23.ZIP / INCLUDE / GADGETS.H < prev    next >
C/C++ Source or Header  |  1993-02-17  |  3KB  |  98 lines

  1. #ifndef GADGETS.H
  2.  
  3. #define GADGETS.H
  4.  
  5. #include "animicon.h"
  6. #include "yakmouse.h"
  7. #include "xlib.h"
  8.  
  9. #define HELP_MASK 4096
  10.  
  11. class gadget : public animicon
  12. {
  13. public:
  14.   enum flagType {normal = 0, touchPad = 1};
  15.   enum gadgetType {buttonType = 1, pSwitchType = 2, sliderType = 3};
  16.   virtual byte isSelected(void);
  17.   word x, y;
  18.   word relX, relY; //used by gadgetManager
  19.   char commandChar;
  20.   flagType flags;
  21.   gadgetType type;
  22.   gadget(char commandChar, char * filename, icon::flagType aflags = icon::normal, yakLib * myYakLib = NULL, gadget::flagType iflags = gadget::normal, int ix = 0, int iy = 0);
  23.   gadget(char icommandChar, animiconNode * thisFrame, gadget::flagType iflags = gadget::normal, int ix = 0, int iy=0);
  24.   gadget(void) : animicon() {x = y = 0; commandChar = 0; flags = normal;};
  25.   virtual void draw(int ix, int iy, word offset) {x=ix; y=iy; animicon::draw(x, y, offset);};
  26.   virtual void draw(word offset = VisiblePageOffs) {draw(x, y, offset);};
  27.   virtual int activate(void) = 0;
  28.   virtual int status(void) = 0;
  29. };
  30.  
  31. class button : public gadget
  32. {
  33. public:
  34.   int returnValue;
  35.   button(int ix, int iy, char commandChar, int returnValue, char * filename, icon::flagType flags = icon::normal, yakLib * myYakLib = NULL, gadget::flagType iflags = gadget::normal);
  36.   virtual int activate(void);
  37.   virtual int status(void);
  38. };
  39.  
  40. class label : public button
  41. {
  42. public:
  43.   char * myText;
  44.   byte fgColor, bgColor;
  45.   label(int ix, int iy, char commandChar, int returnValue, char * text, byte ifgColor = 15, byte ibgColor = 0, gadget::flagType iflags = gadget::normal);
  46.   virtual void draw(int ix, int iy, word offset);
  47.   virtual byte isSelected(void);
  48. };
  49.  
  50. class pSwitch : public gadget
  51. {
  52. public:
  53.   int position;
  54.   pSwitch(int ix, int iy, char commandChar, char * filename, icon::flagType flags = icon::normal, yakLib * myYakLib = NULL, gadget::flagType iflags = gadget::normal);
  55.   virtual int activate(void);
  56.   virtual int status(void);
  57. };
  58.  
  59. class slider : public gadget
  60. {
  61. public:
  62.   int position, width, height;
  63.   int minimumValue, maximumValue;
  64.   byte barColor, borderColor, indicatorColor;
  65.   slider(int ix, int iy, int iwidth, int iheight, int minimumValue, int maximumValue, byte barColor = 0, byte borderColor = 10, byte indicatorColor = 25);
  66.   slider() : gadget() {position = width = height = minimumValue = maximumValue = 0; position = width = height = 0;};
  67.   virtual void draw(word offset = VisiblePageOffs);
  68.   virtual void draw(int x, int y, word offset);
  69.   virtual int activate(void);
  70.   virtual int status(void);
  71. };
  72.  
  73. //Node definitions Follow------------------------------------------>
  74.  
  75. class gadgetNode
  76. {
  77. public:
  78.   gadgetNode * nextGadget;
  79.   gadgetNode * prevGadget;
  80.   gadget * thisGadget;
  81.   gadgetNode(gadget * newGadget, gadgetNode * newNextGadget) {nextGadget = newNextGadget; thisGadget = newGadget, prevGadget = NULL;};
  82. };
  83.  
  84. //list definitions follow----------------------------------------->
  85.  
  86. class gadgetList
  87. {
  88. public:
  89.   gadgetNode * firstGadget;
  90.   gadgetNode * lastGadget;
  91.   virtual int status(void);
  92.   gadgetList() {firstGadget = lastGadget = NULL;};
  93.   void draw(int x, int y, word offset = VisiblePageOffs);
  94.   void draw(word offset = VisiblePageOffs);
  95.   void add(gadgetNode * theNewGadget);
  96. };
  97. #endif
  98.